<?php

namespace App\Admin\Controllers\TextbookAudio;

use App\Admin\Repositories\TextbookAudio\TextbookAudio;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;

class TextbookAudioController extends AdminController
{
    protected $title = '歌曲歌谣';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new TextbookAudio(['category']), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('category.name', '单元');
            $grid->column('unit_name', '单元名称');
            $grid->column('title', '歌曲标题')->limit(60);
            $grid->column('original_singer', '原唱地址');
            $grid->column('vocal_accompaniment', '伴唱地址');
            $grid->column('captions', '字幕')->limit(100);
            $grid->column('video', '视频地址');
            $grid->column('duration', '时长');

            $grid->disableCreateButton();
            $grid->disableActions();
            $grid->disableBatchDelete();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->panel();
                $filter->equal('id')->width(2);
            });
        });
    }
}
